// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Client from '@api/patrol/api/PatrolApi'

import SelectClass from '@api/patrol/model/PatrolPersonRealTimeReq'

const CLIENT = CORE.grpcCLIENT(Client)

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 下拉框 —————————————————————————————— //

  validSelectParam(selectParam, state, { state: { param, DICT } }) {
    return param.tab === DICT.TAB[0][0]
  },
  async getSelect(selectParam, TIP = '查询下拉框') {
    const DTO = CORE.grpcDTO(SelectClass, selectParam)
    const resp = await CORE.grpc(TIP, CLIENT, 'patrolPersonRealTime', DTO)
    return resp.list || []
  },
  transSelect(arr) {
    return arr || [MOCK]
  },
}

// ============================== 内部方法 ============================== //

const MOCK = {
  id: '123',
  userName: '张三',
  areaName: '保安部',
  time: Date.now(),
  pointId: '807961775521308673',
  lat: 30.267692,
  lon: 120.276432,
}
